from PySide6.QtWidgets import QWidget, QPushButton, QApplication
from PySide6.QtCore import Qt, QPoint, Signal
from PySide6.QtGui import QMouseEvent

class PauseWindow(QWidget):
    stop_signal = Signal()
    def __init__(self):
        super().__init__()
        # 设置窗口属性
        self.setWindowFlags(
            Qt.FramelessWindowHint |  # 无边框
            Qt.WindowStaysOnTopHint | # 始终置顶
            Qt.Tool                  # 隐藏任务栏图标
        )
        self.setAttribute(Qt.WA_TranslucentBackground)  # 背景透明
        self.setFixedSize(100, 100)  # 固定窗口大小
        self.move(360,0)
        
        # 创建停止按钮
        self.stop_btn = QPushButton("停止", self)
        self.stop_btn.setFixedSize(60, 60)
        self.stop_btn.setStyleSheet("""
            QPushButton {
                background-color: #FF4444;
                border-radius: 30px;
                color: white;
                font-size: 18px;
                font-weight: bold;
            }
            QPushButton:hover {
                background-color: #FF6666;
            }
            QPushButton:pressed {
                background-color: #CC0000;
            }
        """)
        
        # 将按钮居中
        self.stop_btn.move(
            (self.width() - self.stop_btn.width()) // 2,
            (self.height() - self.stop_btn.height()) // 2
        )
        # 连接按钮点击信号到槽函数
        self.stop_btn.clicked.connect(self.stop_signal.emit)
        self.stop_btn.clicked.connect(self.hide)


if __name__ == "__main__":
    app = QApplication([])
    window = PauseWindow()
    window.show()
    app.exec()
